<?php
session_start();
//var_dump($_SESSION);
//echo count($_SESSION);
if(!isset($_SESSION['loggedIn'])){
	header('location:viewAuthadmin.php');
}

if (isset($_POST['cari'])){
include '../config/db_config.php';
include '../lib/kelola_technopreneur.php';

$cari = $_POST['cari'];
$kelolaTechnopreneur = new kelola_technopreneur ();
$result = $kelolaTechnopreneur->cariTechnopreneur($cari);

//$search;
//while ($row = mysql_fetch_assoc($result)) {
	//$search = $row;
	//var_dump($result);
//}
$techno;
while ($row = mysql_fetch_assoc($result)) {
	$p=array();
	$p['NAMA'] = $row['NAMA'];
	$p['ID_TECHNOPRENEUR'] = $row['ID_TECHNOPRENEUR'];
$techno[]=$p;			
}

//var_dump($p);
//var_dump($techno);
}
?>



<html>
<head>
    <title>Smart Commerce</title>
    <link href="../css/bootstrap.min.css" rel="stylesheet">
	<style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
    </style>
    <link href="../css/bootstrap-responsive.min.css" rel="stylesheet">
</head>
<body>
	<?php include 'header_admin.php';	
	?>
	
	<?php
	if (!empty($_GET['message']) && $_GET['message'] == 'success') {
    echo '<div class="alert alert-success">Akun Technopreneur berhasil dihapus !<button class="close" data-dismiss="alert">&times;</button></div>';
	}
	?>	
<!--tampilan pencarian-->
	<div class="container">
	<h3>Hasil Pencarian</h3>
	<table class='table table-bordered table-hover' style='width:850;' border='0' cellspacing='0' cellpadding='2'>
		
	<?php
		if (isset($techno)&& count($techno)>0){
		for ($i=0 ; $i<count($techno); $i++){
			echo '<tr>';
			echo '<td>';
			//echo '<div class="row">';
			echo '<a href="profil_technopreneur.php?id='.$techno[$i]['ID_TECHNOPRENEUR'].'" class="pull-left">';
			echo '<div class="span2">';
			  echo '<div class="span1"></div>';
			  echo '<div class="span7" style="vertical-align:top; color:black; ">';
				echo '<h4>'.$techno[$i]['NAMA'].'</h4>';
			  echo '</div>';
			  echo '<div class="span1"> <a class=" btn btn-small btn-danger pull-right" href="#" onclick="hapus('.$techno[$i]['ID_TECHNOPRENEUR'].')">hapus</a> </div>';
			  echo '</a>';
			 // echo '</div>';
			echo '</td>';
			echo '</tr>';
			}
		}
			else {
			echo '<h4>Technopreneur tidak dapat ditemukan</h4>';
			}
		
		?>
<script>
function hapus(id){
	var c=confirm ('Apakah Anda akan menghapus Akun technopreneur ini beserta produk dan reviewnya ?');
	if(c){
		window.location='hapusTechno.php?id='+id;
	}
}
</script>		
</body>

</html>